<template>
    <div class="drawerContainer">
        <el-form :model="propJson" label-width="auto" style="width: 100%">
            <el-form-item label="绑定参数">
                <el-select v-model="propJson.bindVariable" placeholder="参数名称" style="width: 100%">
                    <el-option v-for="info in commonParam" :label="info.variableName" :value="info.variableName" />
                </el-select>
            </el-form-item>

            <el-form-item label="尺寸">
                <el-radio-group v-model="propJson.size">
                    <el-radio label="default">默认</el-radio>
                    <el-radio label="large">大号</el-radio>
                    <el-radio label="small">小号</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="显示提示内容">
                <el-input v-model="propJson.placeHolder" style="width: 100%" placeholder="显示提示内容" />
            </el-form-item>

            <el-form-item label="是否对长度进行限制">
                <el-radio-group v-model="propJson.isLengthLimit">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="最大长度" v-if="propJson.isLengthLimit">
                <el-input v-model="propJson.maxLength" style="width: 100%" placeholder="最大长度" />
            </el-form-item>

            <el-form-item label="是否禁用">
                <el-radio-group v-model="propJson.isDisable">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="是否可清空">
                <el-radio-group v-model="propJson.isClearable">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="是否密文显示">
                <el-radio-group v-model="propJson.isPassword">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="是否启用文本域">
                <el-radio-group v-model="propJson.isTextArea">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="是否自适应高度" v-if="propJson.isTextArea">
                <el-radio-group v-model="propJson.isAutoSize">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="最小行数" v-if="propJson.isTextArea && !propJson.isAutoSize">
                <el-input v-model="propJson.textAreaMinRow" style="width: 100%" placeholder="最小行数" />
            </el-form-item>
            <el-form-item label="最大行数" v-if="propJson.isTextArea && !propJson.isAutoSize">
                <el-input v-model="propJson.textAreaMaxRow" style="width: 100%" placeholder="最大行数" />
            </el-form-item>

            <el-divider>数据联动</el-divider>
            <FormDataAssociation :rule-info="propJson.ruleInfo ? propJson.ruleInfo : {}" :common-param="commonParam"/>
        </el-form>
    </div>
</template>

<script>
import FormDataAssociation from "@/components/lowcode/service/FormDataAssociation";

export default {
    name: "InputDrawer",
    props: ['commonParam'],
    components: {
        FormDataAssociation
    },
    computed: {
        propJson() {
            return this.$store.state.lowCodeDrawerJsonInfo;
        }
    }
}
</script>

<style scoped lang="less">

</style>